package day4;

import java.util.Calendar;
import java.util.Date;

/**
 * @author oldliu
 * @since 1.0
 */
public class CalendarRTest {
    public static void main(String[] args) {
        Calendar c=Calendar.getInstance();//获得对象
        System.out.println(c);
        System.out.println("获得Date");
        Date time = c.getTime();
        System.out.println(time);
        long time2=c.getTimeInMillis();
        System.out.println("毫秒:"+time2);
        //获得所有
        int year = c.get(Calendar.YEAR);
        System.out.println("年："+year);
        int month = c.get(Calendar.MONTH);
        System.out.println("月："+month);
        int date = c.get(Calendar.DAY_OF_MONTH);
        System.out.println("天："+date);
        System.out.println("一周的起点:"+c.getFirstDayOfWeek());
        //c.setFirstDayOfWeek(Calendar.MONDAY);//???
        int week=c.get(Calendar.DAY_OF_WEEK);//1--7
        System.out.println("周："+week);
        //
        System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
        int yearday=c.get(Calendar.DAY_OF_YEAR);
        System.out.println("今天是今年第几天:"+yearday);
        int yearweek=c.get(Calendar.WEEK_OF_YEAR);
        System.out.println("本周是今年第几周:"+yearweek);
        //今年多少天
        int days=c.getActualMaximum(Calendar.DAY_OF_YEAR);
        System.out.println("今年总共的天数:"+days);
    }
}
